package com.ruoyi.deeplearn.service.impl;

import java.util.List;

import cn.hutool.core.util.IdUtil;
import com.ruoyi.common.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.deeplearn.mapper.DeepModelVersionMapper;
import com.ruoyi.deeplearn.domain.DeepModelVersion;
import com.ruoyi.deeplearn.service.IDeepModelVersionService;

/**
 * 模型Service业务层处理
 *
 * @author rww
 * @date 2024-09-09
 */
@Service
public class DeepModelVersionServiceImpl implements IDeepModelVersionService
{
    @Autowired
    private DeepModelVersionMapper deepModelVersionMapper;

    /**
     * 查询模型
     *
     * @param id 模型主键
     * @return 模型
     */
    @Override
    public DeepModelVersion selectDeepModelVersionById(Long id)
    {
        return deepModelVersionMapper.selectDeepModelVersionById(id);
    }

    /**
     * 查询模型列表
     *
     * @param deepModelVersion 模型
     * @return 模型
     */
    @Override
    public List<DeepModelVersion> selectDeepModelVersionList(DeepModelVersion deepModelVersion)
    {
        return deepModelVersionMapper.selectDeepModelVersionList(deepModelVersion);
    }

    /**
     * 新增模型
     *
     * @param deepModelVersion 模型
     * @return 结果
     */
    @Override
    public int insertDeepModelVersion(DeepModelVersion deepModelVersion)
    {
        deepModelVersion.setId(IdUtil.getSnowflakeNextId());
        deepModelVersion.setCreateTime(DateUtils.getNowDate());
        return deepModelVersionMapper.insertDeepModelVersion(deepModelVersion);
    }

    /**
     * 修改模型
     *
     * @param deepModelVersion 模型
     * @return 结果
     */
    @Override
    public int updateDeepModelVersion(DeepModelVersion deepModelVersion)
    {
        deepModelVersion.setUpdateTime(DateUtils.getNowDate());
        return deepModelVersionMapper.updateDeepModelVersion(deepModelVersion);
    }

    /**
     * 批量删除模型
     *
     * @param ids 需要删除的模型主键
     * @return 结果
     */
    @Override
    public int deleteDeepModelVersionByIds(Long[] ids)
    {
        return deepModelVersionMapper.deleteDeepModelVersionByIds(ids);
    }

    /**
     * 删除模型信息
     *
     * @param id 模型主键
     * @return 结果
     */
    @Override
    public int deleteDeepModelVersionById(Long id)
    {
        return deepModelVersionMapper.deleteDeepModelVersionById(id);
    }
}
